

#ifndef  __LIB_FFMPEG_H__
#define  __LIB_FFMPEG_H__


#include "debug.h"
#include "include_com.h"
#include "include_other.h"


typedef enum
{
	DECODE_IDLE = 0,
	
    DECODE_STREAM,
	
    DECODE_READ_PACKET,
    
    DECODE_PAUSE,
	
    DECODE_STOP,

} decode_state_e;


#define  MAX_AUDIO_FRAME_SIZE        192000 // 1 second of 48khz 32bit audio

//Invalid source: 1280x2768. max input: 4096x2304

#define  MAX_VIDEO_W       (2560)
#define  MAX_VIDEO_H       (2560)

typedef struct _f_para_t 
{

	int32_t		f_state;
	int32_t		f_ready;
	int32_t		f_stop;

	int32_t		f_video_stop;
	int32_t		f_audio_stop;
	int32_t		f_alsa_stop;
	
	int32_t		f_v_index;
	int32_t		f_a_index;

	int64_t   	f_duration;
	int64_t   	f_start_time;
	
	double      f_a_clock;
	double      f_v_clock;

	int32_t 	f_v_w;
	int32_t 	f_v_h;
	
	int32_t 	f_fps;

	int32_t 	f_s_fmt;
	int64_t     f_in_ch_l;

	char		f_name[1024];

	int32_t          f_pcm_size;
	uint8_t*    	 f_pcm_buff;

	AVStream *       f_v_stream;

	AVFormatContext* f_avformat;
	AVCodecContext*	 f_v_ctx;
	struct AVCodec*	 f_v_codec;

	AVCodecContext*	 f_a_ctx;
	struct AVCodec*	 f_a_codec;

	AVPacket*		 f_apacket;
	AVPacket*		 f_vpacket;
	
	AVFrame* 		 f_a_frame;
	
	struct SwrContext* f_acvt_ctx;

	pthread_t  		 f_read_thread;
	pthread_t  		 f_a_dec_thread;	

	SDL_mutex *		 f_mutex;
}f_para_t;



#endif




